#pragma once
#include <tom.ice>

module Xts
{
	module Tom
	{
		module MarketData
		{
			//Market Data Type Definitions
		   //Type of Tick Data
		   enum XTickType{NotSet, Bid, Ask, Trade, HighPrice, LowPrice, OpenPrice, OpenInterest, PreviousClose, DailyVolume, CurrentTime};
		   
		   //Tick Value
		   ["cpp:class", "cs:attribute:System.Serializable"]
		   struct XTickValue
		   {
				XTickType			TickType = NotSet;
				double         		Price;
				long           		Size;
				Util::XTime    		TickTime;
		   };
		   //Series of Tick Value	 
		   sequence<XTickValue> 	XTickSeries;
		   
		   //Tick Data 
		   ["cpp:class", "cs:attribute:System.Serializable"] 
		   struct XTickData{
				XSymbolTag     		SymbolTag;
				XTickValue			TickValue;	
		   };	   
		   
		   //Tick Data Set
		   ["cpp:class", "cs:attribute:System.Serializable"] 
		   struct XTickDataSet
		   {
				XSymbolTag     		SymbolTag;
				Util::XTime    		BeginTime;
				Util::XTime    		EndTime;
				XTickSeries			TickSeries;
		   };
		   
		   //Snapshot Value
		   ["cpp:class", "cs:attribute:System.Serializable"]
		   struct XSnapshotValue
		   {
				double      	   	PreClosePrice;
				double      	   	PreOpenInterest;
				double      	   	PreSettlementPrice;
				double       	  	OpenPrice;
				double      	   	TurnOver;
				double      	   	OpenInterest;
				double      	   	ClosePrice;
				double      	   	HighPrice;
				double      	   	LowPrice;
				double      	   	LastPrice;
				long        	   	LastSize;
				double     	    	SettlementPrice;
				double     	    	UpperLimitPrice;
				double       	  	LowerLimitPrice;
				double      	   	PreDelta;
				double      	   	CurDelta;
				long       	    	Volume;
				long        	   	AvgVolume;
				long         	  	HisVolume;
				long         	  	Deals;
				double       	  	PERadio1;
				double       	  	PERadio2;
				double        	 	BidPrice1;
				long          	 	BidVolume1;
				double        	 	BidPrice2;
				long        	   	BidVolume2;
				double       	  	BidPrice3;
				long         	  	BidVolume3;
				double       	  	BidPrice4;
				long         	  	BidVolume4;
				double				BidPrice5;
				long        	   	BidVolume5;
				double     	    	AskPrice1;
				long       		   	AskVolume1;
				double     	    	AskPrice2;
				long        	   	AskVolume2;
				double       	  	AskPrice3;
				long         	  	AskVolume3;
				double       	  	AskPrice4;
				long           		AskVolume4;
				double         		AskPrice5;
				long           		AskVolume5;
				double         		AvgPrice;
				Util::XTime			SnapshotTime;
		   };
		   //Series of Snapshot Value
		   sequence<XSnapshotValue> XSnapshotSeries;
		   
		   //Snapshot Data 	  
		   ["cpp:class", "cs:attribute:System.Serializable"] 
		   struct XSnapshotData{
				XSymbolTag     		SymbolTag;	 		    
				XSnapshotValue		SnapshotValue;
		   };	   
		   
		   ["cpp:class", "cs:attribute:System.Serializable"] 
		   struct XSnapshotDataSet
		   {
				XSymbolTag     		SymbolTag;
				Util::XTime    		BeginTime;
				Util::XTime    		EndTime;
				XSnapshotSeries		SnapshotSeries;
		   };
		   
		   //Bar Value
		   ["cpp:class", "cs:attribute:System.Serializable"]
		   struct XBarValue
		   {
				double         		Open;
				double         		High;
				double         		Low;
				double         		Close;
				long         		TradeVolume;
				double         		OpenInterest;
				Util::XTime    		BarDateTime;
		   };
		   //Series for BarDatas
		   sequence<XBarValue>  XBarSeries;
		   
		   //Bar Data
		   ["cpp:class", "cs:attribute:System.Serializable"] 
		   struct XBarData{
				XSymbolTag     		SymbolTag;
				Util::XTime			BarFrequency;
				XBarValue			BarValue;			
		   };
		   
		   //Bar Data Set
		   ["cpp:class", "cs:attribute:System.Serializable"] 
		   struct XBarDataSet
		   {
				XSymbolTag     		SymbolTag;
				Util::XTime			BarFrequency;
				Util::XTime    		BeginTime;
				Util::XTime    		EndTime;
				XBarSeries			BarSeries;
		   };
				
		   
		   ["cpp:class", "cs:attribute:System.Serializable"]
		   struct XIndicatorTag{
				string				Name;
				XSymbolTag  		SymbolTag;		   
				int       			Periods;					//How many bars
		   };
		   
		   //Indicator Value
		   ["cpp:class", "cs:attribute:System.Serializable"]
		   struct XIndicatorValue
		   {
				double        		CurrentValue;
				Util::XTime     	IndicatorTime;
		   };
		   //Series of indicators
		   sequence<XIndicatorValue> XIndicatorSeries;
		   
		   ["cpp:class", "cs:attribute:System.Serializable"]
		   struct XIndicatorData{
				XIndicatorTag  		IndicatorTag;
				XIndicatorValue		IndicatorValue;
		   };	   
		   
		   ["cpp:class", "cs:attribute:System.Serializable"]
		   struct XIndicatorDataSet{
				XIndicatorTag  		IndicatorTag;
				Util::XTime			BeginTime;
				Util::XTime			EndTime;
				XIndicatorSeries	IndicatorSeries;
		   };
		   
		   
		   //Realtime Market Data  Monitor Interfaces 
		   interface IXTickDataMonitor{
			  void NewTick(XTickData tickData);
		   };
		   
		   interface IXSnapshotDataMonitor{
			  void NewSnapshot(XSnapshotData snapshotData);
		   };
		   
		   interface IXIndicatorMonitor{
			  void  NewIndicator(XIndicatorData indicatorData);
		   };
		};
	};
};